package com.srv.common;

import java.util.Random;

import com.srv.util.ConfigProps;

public class DefaultSelectStrategy implements IDataSourceSelectStrategy {

	private static final String KEY_DATASOURCE_SELECT_FIELD = "datasource.select.field";
	
	private static final int DEFAULT_SELECT_FIELD = 1;
	
	public int getDateSourceNumber() {
		int field = ConfigProps.get().getInt(KEY_DATASOURCE_SELECT_FIELD, DEFAULT_SELECT_FIELD);
		Random random = new Random();
		int dsNum = random.nextInt(field);
		return dsNum;
	}
}
